﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Nuzzle.Protocol.Types.Game.Character.Characteristic
{
    public class CharacterCharacteristicsInformations
    {
        public double Experience { get; set; }
        public double ExperienceLevelFloor { get; set; }
        public double ExperienceNextFloor { get; set; }
        public int Kamas { get; set; }
        public int StatsPoints { get; set; }
        public int SpellPoints { get; set; }
        public Alignment.ActorExtendedAlignmentInformations AlignInfos { get; set; }
        public int LifePoints { get; set; }
        public int MaxLifePoints { get; set; }
        public short EnergyPoints { get; set; }
        public short MaxEnergyPoints { get; set; }
        public short ActionPointsCurrent { get; set; }
        public short MovementPointsCurrent { get; set; }
        public CharacterBaseCharacteristic Initiative{get;set;}
        public CharacterBaseCharacteristic Prospection { get; set; }
        public CharacterBaseCharacteristic ActionPoints { get; set; }
        public CharacterBaseCharacteristic MovementPoints { get; set; }
        public CharacterBaseCharacteristic Strenght { get; set; }
        public CharacterBaseCharacteristic Vitality { get; set; }
        public CharacterBaseCharacteristic Wisdom { get; set; }
        public CharacterBaseCharacteristic Chance { get; set; }
        public CharacterBaseCharacteristic Agility { get; set; }
        public CharacterBaseCharacteristic Intelligence { get; set; }

        public CharacterCharacteristicsInformations(double experience, double experienceLevelFloor,
            double experienceNextFloor, int kamas, int statsPoints, int spellPoints,
            Alignment.ActorExtendedAlignmentInformations alignInfos, int lifePoints,
            int maxLifePoints, short energyPoints, short maxEnergyPoints, short actionPointsCurrent,
            short movementPointsCurrent, 
            CharacterBaseCharacteristic initiative,
            CharacterBaseCharacteristic prospection,
            CharacterBaseCharacteristic actionPoints,
            CharacterBaseCharacteristic movementPoints,
            CharacterBaseCharacteristic strenght,
            CharacterBaseCharacteristic vitality,
            CharacterBaseCharacteristic wisdom,
            CharacterBaseCharacteristic chance,
            CharacterBaseCharacteristic agility,
            CharacterBaseCharacteristic intelligence)
        {
            this.Experience = experience;
            this.ExperienceLevelFloor = experienceLevelFloor;
            this.ExperienceNextFloor = experienceNextFloor;
            this.Kamas = kamas;
            this.StatsPoints = statsPoints;
            this.SpellPoints = spellPoints;
            this.AlignInfos = alignInfos;
            this.LifePoints = lifePoints;
            this.MaxLifePoints = maxLifePoints;
            this.EnergyPoints = energyPoints;
            this.MaxEnergyPoints = maxEnergyPoints;
            this.ActionPointsCurrent = actionPointsCurrent;
            this.MovementPointsCurrent = movementPointsCurrent;
            this.Initiative = initiative;
            this.Prospection = prospection;
            this.ActionPoints = actionPoints;
            this.MovementPoints = movementPoints;
            this.Strenght = strenght;
            this.Vitality = vitality;
            this.Wisdom = wisdom;
            this.Chance = chance;
            this.Agility = agility;
            this.Intelligence = intelligence;
            
        }

        public void Serialize(NetworkMessage message)
        {
            message.WriterBuffer.writeDouble(this.Experience);
            message.WriterBuffer.writeDouble(this.ExperienceLevelFloor);
            message.WriterBuffer.writeDouble(this.ExperienceNextFloor);
            message.WriterBuffer.writeInt(this.Kamas);
            message.WriterBuffer.writeInt(this.StatsPoints);
            message.WriterBuffer.writeInt(this.SpellPoints);

            this.AlignInfos.Serialize(message);

            message.WriterBuffer.writeInt(this.LifePoints);
            message.WriterBuffer.writeInt(this.MaxLifePoints);
            message.WriterBuffer.writeShort(this.EnergyPoints);
            message.WriterBuffer.writeShort(this.MaxEnergyPoints);
            message.WriterBuffer.writeShort(this.ActionPointsCurrent);
            message.WriterBuffer.writeShort(this.MovementPointsCurrent);

            this.Initiative.Serialize(message);
            this.Prospection.Serialize(message);
            this.ActionPoints.Serialize(message);
            this.MovementPoints.Serialize(message);
            this.Strenght.Serialize(message);
            this.Vitality.Serialize(message);
            this.Wisdom.Serialize(message);
            this.Chance.Serialize(message);
            this.Agility.Serialize(message);
            this.Intelligence.Serialize(message);

            var temp = new CharacterBaseCharacteristic(0, 0, 0, 0);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);

            message.WriterBuffer.writeShort(0);

            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);
            temp.Serialize(message);

            message.WriterBuffer.writeShort(0);
        }
    }
}
